@import url('./common/header.css');

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --text-color: #333;
    --text-light: #666;
    --border-color: #dee2e6;
    --background-color: #f5f7fa;
    --white: #fff;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --spacing: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing);
    padding-bottom: 80px;
}

.checkout-content {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.address-section {
    margin-bottom: 2rem;
}

.address-section h3 {
    color: #2c3e50;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #4a90e2;
}

.address-form {
    display: grid;
    gap: 1.5rem;
}

.form-group {
    display: grid;
    gap: 0.5rem;
}

.form-group label {
    color: #2c3e50;
    font-size: 0.95rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #2c3e50;
    background: #f8f9fa;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* 错误状态 */
.form-group.error input,
.form-group.error textarea {
    border-color: #e74c3c;
}

.form-group.error .error-message {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

/* 必填标记 */
.form-group label::after {
    content: "*";
    color: #e74c3c;
    margin-left: 0.3rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .checkout-content {
        margin: 1rem;
        padding: 1.5rem;
    }

    .address-section h3 {
        font-size: 1.2rem;
        margin-bottom: 1.2rem;
    }

    .form-group input,
    .form-group textarea {
        padding: 0.7rem;
    }
}

/* 提交按钮样式 */
.submit-btn {
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.8rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
    margin-top: 1.5rem;
}

.submit-btn:hover {
    background: #357abd;
}

/* 输入框占位符样式 */
.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #a0aec0;
}

.checkout-form {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--spacing);
    margin-top: var(--spacing);
}

.form-group {
    margin-bottom: var(--spacing);
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: #545b62;
}

.order-summary {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--spacing);
    margin-top: var(--spacing);
}

.order-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.order-item:last-child {
    border-bottom: none;
}

.product-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-right: var(--spacing);
}

.product-info {
    flex: 1;
}

.product-name {
    font-size: 18px;
    color: var(--text-color);
    margin-bottom: 5px;
}

.product-price {
    color: var(--danger-color);
    font-size: 18px;
    font-weight: bold;
}

.total-amount {
    font-size: 20px;
    font-weight: bold;
    text-align: right;
    margin-top: var(--spacing);
    color: var(--danger-color);
}

.address-section {
    background: var(--white);
    padding: var(--spacing);
    margin-bottom: var(--spacing);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.address-form {
    display: grid;
    grid-gap: var(--spacing);
    max-width: 600px;
}

.form-group {
    display: grid;
    grid-template-columns: 100px 1fr;
    align-items: center;
    gap: var(--spacing);
}

.form-group input,
.form-group textarea {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 100%;
}

.form-group textarea {
    height: 80px;
    resize: vertical;
}

.order-items {
    background: var(--white);
    padding: var(--spacing);
    margin-bottom: var(--spacing);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.order-item {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: var(--spacing);
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.order-item:last-child {
    border-bottom: none;
}

.item-image img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius);
}

.item-info {
    display: grid;
    gap: var(--spacing);
}

.item-info h4 {
    margin: 0;
    color: var(--text-color);
}

.item-price {
    color: var(--danger-color);
    font-weight: bold;
}

.item-quantity {
    color: var(--text-light);
}

.item-subtotal {
    color: var(--danger-color);
    font-weight: bold;
}

.checkout-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing);
    background-color: var(--white);
}

.checkout-table th,
.checkout-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.checkout-table th {
    background-color: var(--background-color);
    font-weight: 600;
    color: var(--text-color);
    padding: 15px 12px;
}

.product-image-cell {
    width: 120px;
    padding: 10px;
}

.product-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.product-name {
    text-align: left;
    display: flex;
    align-items: center;
    gap: var(--spacing);
    padding-left: var(--spacing);
}

.product-name input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    border-radius: var(--radius);
    border: 2px solid var(--primary-color);
    transition: all 0.2s ease;
}

.product-name input[type="checkbox"]:checked {
    background-color: var(--primary-color);
}

.product-price {
    color: var(--danger-color);
    font-weight: 600;
    font-size: 1.1rem;
}

.quantity-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing);
}

.quantity-btn {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.quantity-btn:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.quantity-btn:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
    transform: none;
}

.quantity-input {
    width: 3rem;
    height: 2rem;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    transition: border-color 0.3s ease;
}

.quantity-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.total-section {
    margin-top: var(--spacing);
    padding: var(--spacing);
    background: linear-gradient(to right, #F8FAFF, #F0F4F8);
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.total-amount {
    font-size: 1.2rem;
    font-weight: 500;
}

.total-price {
    color: var(--danger-color);
    font-size: 1.5rem;
    font-weight: 700;
}

.checkout-btn {
    background: linear-gradient(135deg, var(--success-color), #219653);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.checkout-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.error-message {
    color: var(--danger-color);
    background-color: #FEF2F2;
    border: 1px solid #FECACA;
    padding: var(--spacing);
    border-radius: var(--radius);
    margin-bottom: var(--spacing);
    display: none;
    font-weight: 500;
}

.order-summary {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e1e8ed;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid #e1e8ed;
    font-size: 1rem;
    color: #2c3e50;
}

.summary-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.summary-item span:first-child {
    color: #64748b;
}

.summary-item .price {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
}

.summary-item.total {
    margin-top: 1rem;
    padding-top: 1.2rem;
    border-top: 2px solid #e1e8ed;
    font-size: 1.2rem;
    font-weight: 500;
}

.summary-item.total .price {
    color: #e74c3c;
    font-size: 1.5rem;
    font-weight: 600;
}

.submit-order {
    margin-top: 2rem;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.submit-order:hover {
    background: linear-gradient(135deg, #357abd, #2868a5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

@media (max-width: 768px) {
    .container {
        margin: 1rem;
        padding: 1rem;
    }

    .checkout-table {
        font-size: 0.9rem;
    }

    .quantity-btn {
        width: 1.75rem;
        height: 1.75rem;
    }

    .quantity-input {
        width: 2.5rem;
    }

    .total-section {
        flex-direction: column;
        gap: var(--spacing);
        text-align: center;
    }

    .checkout-btn {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .form-group {
        grid-template-columns: 1fr;
    }

    .order-item {
        grid-template-columns: 80px 1fr;
    }
}

@media (max-width: 768px) {
    .order-summary {
        margin-top: 1.5rem;
        padding: 1.2rem;
    }

    .summary-item {
        padding: 0.6rem 0;
        font-size: 0.95rem;
    }

    .summary-item .price {
        font-size: 1rem;
    }

    .summary-item.total {
        font-size: 1.1rem;
    }

    .summary-item.total .price {
        font-size: 1.3rem;
    }

    .submit-order {
        padding: 0.9rem;
        font-size: 1rem;
    }
}
